package com.retail.order.controller;

import com.alipay.api.domain.OrderDetail;
import com.retail.common.core.domain.Result;
import com.retail.order.domain.TOrderDetails;
import com.retail.order.dto.OrderDetailResponse;
import com.retail.order.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("orderDetail")
public class OrderDetailController {
    @Autowired
    OrderDetailService orderDetailService;

    /**
     * 查看订单详情
     * @param orderId
     * @return
     */
    @GetMapping("/lookDetail")
    public Result<List<OrderDetailResponse>>lookDetail(@RequestParam("orderId") Long orderId){
        List<OrderDetailResponse>lookDetail = orderDetailService.lookDetail(orderId);
        return Result.success(lookDetail);
    }


    @PostMapping("/orderDetailInstall")
    public Result orderDetailInstall(@RequestBody TOrderDetails tOrderDetails){
        Result result = orderDetailService.orderDetailInstall(tOrderDetails);
        return result;
    }
}
